package com.yyds.yygh.oss.controller.api;

import com.yyds.yygh.common.result.Result;
import com.yyds.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/oss/file")
@Api(tags = "文件处理接口")
public class FileApiController{
    @Autowired
    private FileService fileService;

    @ApiOperation("文件上传")
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile multipartFile){
        //参数multipartFile表示上传的文件
        String url = fileService.upload(multipartFile);
        return Result.success(url);
    }


}